package offer;

import java.util.Arrays;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Map;

@FunctionalInterface
public interface LongestStrChain {
    int longestStrChain(String[] words);
}
class LongestStrChainImpl1 implements LongestStrChain{

    @Override
    public int longestStrChain(String[] words) {
        int n = words.length;
        int[] dp = new int[n];
        Arrays.sort(words, new Comparator<String>() {
            @Override
            public int compare(String o1, String o2) {
                return o1.length() - o2.length();
            }
        });
        Map<String, Integer> map = new HashMap<>();
        for (int i = 0; i < n; i++) {
            map.put(words[i], i);
        }
        for (int i = 0; i < n; i++) {
            dp[i] = 0;
        }
        for (int i = n - 1; i >= 0; i--) {
            String curStr = words[i];
            int curStrLen = curStr.length();
            String subStr = curStr.substring(0,curStrLen);
        }

        return 0;
    }
}

